# coding=utf8
from pydub import AudioSegment
import os


def parse_file(file_path):
    p = os.path.dirname(file_path)
    file_name = os.path.basename(file_path).split(".")[0]
    ext = os.path.basename(file_path).split(".")[1]
    AudioSegment.from_file(file_path, "flac")
    # AudioSegment.export(os.path.join(p, "{}.mp3".format(file_name)), "mp3")
    print file_name, ext

parse_file(r"c:\Users\TU\Music\a.flac")